package pe.com.bvl.controller;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import pe.com.bvl.form.LoginForm;

@Controller
@RequestMapping("/login")
public class LoginController {

  
  public String inicio(Model model) {
    model.addAttribute("mensaje", "hola mundo");
    return "login";
  }

  @RequestMapping(method = RequestMethod.GET)
  public String loadForm(Map model, @ModelAttribute("loginForm") LoginForm myForm) {
    return "login";
  }
  
  @RequestMapping(params = "accion=buscar")
  public String submitForm(Map model, @ModelAttribute("loginForm") LoginForm myForm) {
    myForm.setUsuario("pabloasd");
    myForm.setClave("12345");
    return "login";
  }
}
